import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入对 push 和 replace 增强的文件
import './extendRouter'

// 导入组件
import Index from '@/views/Index'
import Login from '@/views/Login'
import Register from '@/views/Register'
import Search from '@/views/Search'
import Test from '@/views/Test'

Vue.use(VueRouter)

// 配置路由规则
const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: Index
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/search',
    component: Search
  },
  {
    path: '/test',
    component: Test
  }
]

const router = new VueRouter({
  routes
})

export default router
